package explorer;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.io.File;

import javax.swing.JLabel;
import javax.swing.JPanel;

import explorer.abstractFactory.ProxyFactoryLoader;

public class ElementsPanel{
	
	private JPanel elementPanel;
	private JLabel text;
	private ElementsController event;
	private String nameFile;
	
	
	public JPanel elementsPanel(int n, File content, ProxyFactoryLoader factory) {
		
		elementPanel=new JPanel();
		elementPanel.setMaximumSize(new Dimension(70,70));
		elementPanel.setLayout(new BorderLayout());
		
		nameFile= new String(content.getName());
		text=new JLabel(nameFile);
		elementPanel.add(new ImageLoader(content, factory));
		elementPanel.add(text, BorderLayout.SOUTH);
		elementPanel.setPreferredSize(new Dimension(80, 85));
		event=new ElementsController(elementPanel, content);
		elementPanel.addMouseListener(event);

		return elementPanel;
	}
	
	
}